#include "Renderer_PCH.h"
#include "RBlendState.h"

/*--------------------------------------------------------------------------*/

RBlendState::RBlendState() :
	m_srcFactor(GL_ONE),
	m_dstFactor(GL_ONE),
	m_blendEquation(GL_LEQUAL)
{

}

/*--------------------------------------------------------------------------*/

GLenum RBlendState::GetSrcFactor() const
{
	return m_srcFactor;
}

/*--------------------------------------------------------------------------*/

GLenum RBlendState::GetDstFactor() const
{
	return m_dstFactor;
}

/*--------------------------------------------------------------------------*/

GLenum RBlendState::GetBlendEquation() const
{
	return m_blendEquation;
}

/*--------------------------------------------------------------------------*/

void RBlendState::SetSrcFactor(GLenum n)
{
#ifdef _DEBUG

#endif
	m_srcFactor = n;
}

/*--------------------------------------------------------------------------*/

void RBlendState::SetDstFactor(GLenum n)
{
#ifdef _DEBUG

#endif
	m_dstFactor = n;
}

/*--------------------------------------------------------------------------*/

void RBlendState::SetBlendEquation(GLenum n)
{
#ifdef _DEBUG

#endif
	m_blendEquation = n;
}

/*--------------------------------------------------------------------------*/

void RBlendState::Bind() const
{
	if (m_srcFactor == GL_ONE && m_dstFactor == GL_ZERO)
	{
		glDisable(GL_BLEND);
	}
	else
	{
		glEnable(GL_BLEND);
		glBlendFunc(m_srcFactor, m_dstFactor);
		glBlendEquation(m_blendEquation);
	}

}

/*--------------------------------------------------------------------------*/